import React, { Component } from 'react';
import { View, Text, StyleSheet, ScrollView } from 'react-native';
import Utils from '../utils';
import {NavigationActions,StackActions} from 'react-navigation';

export default class AppHome extends Component {

    _dispatch = (route)=>{
        const resetAction = StackActions.reset({
            index: 0,
            actions: [
                NavigationActions.navigate({routeName:route}),
            ],
        });

        this.props.navigation.dispatch(resetAction)
    }



    static navigationOptions = (e) => {
        return {
            title: "",
            headerBackTitle: null,
            headerMode: 'none',
        }
    }

    componentDidMount() {
        const { navigate } = this.props.navigation;
        Utils.getLoginInfo().then(user => {
            if (user) {
               this._dispatch("Home")

            } else {
                this._dispatch("Login");
            }

        })
    }

    render (){
        return (
            <View></View>
        )
    }

  
}